package com.example.demo;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by liupeng on 2017/12/9.
 */
@ControllerAdvice
public class GlobalDefaultExceptionHandle {

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public String defaultExceptionHandle(HttpServletRequest req,Exception e)
    {
        return "对不起，服务器繁忙，请稍后再试！";
    }
}
